package com.chongjing.web.controller.chat;

import com.chongjing.chat.domain.GroupData;
import com.chongjing.chat.domain.MessageConditionData;
import com.chongjing.chat.domain.MessageResponse;
import com.chongjing.chat.service.IGroupService;
import com.chongjing.common.annotation.DataSource;
import com.chongjing.common.core.controller.BaseController;
import com.chongjing.common.core.page.TableDataInfo;
import com.chongjing.common.enums.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/chat")
@DataSource(DataSourceType.SLAVE) //这样，执行该方法的时候就会选择SLAVE数据源
public class GroupController extends BaseController {
    @Autowired
    IGroupService iGroupService;
    /**
     * 分页查询群组列表
     */
    @PreAuthorize("@ss.hasPermi('chat:group:list')")
    @GetMapping("/pageGroupData")
    public TableDataInfo page(GroupData groupData)
    {
        log.info("查询条件：{}",groupData);
        startPage();
        List<GroupData> list = iGroupService.page(groupData);
        return getDataTable(list);
    }

}
